/**
 * 自定义Prism.js主题，匹配图片中的代码高亮样式
 */

code[class*="language-"],
pre[class*="language-"] {
  color: #f8f8f2;
  background: none;
  text-shadow: 0 1px rgba(0, 0, 0, 0.3);
  font-family:
    "Fira Code", Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
  font-size: 14px;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 20px;
  tab-size: 4;
  hyphens: none;
}

/* Code blocks */
pre[class*="language-"] {
  padding: 1em;
  margin: 0.5em 0;
  overflow: auto;
  border-radius: 0;
  background: #1e1e1e !important;
}

/* 当代码块在包装器内时，设置底部圆角 */
.code-block-wrapper pre[class*="language-"] {
  border-radius: 0;
  border-bottom-left-radius: 0.75rem;
  border-bottom-right-radius: 0.75rem;
  margin: 0;
}

:not(pre) > code[class*="language-"],
pre[class*="language-"] {
  background: #1e1e1e;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
  padding: 0.1em;
  border-radius: 0.3em;
  white-space: normal;
}

/* 自定义代码块样式 */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #6a9955;
}

.token.punctuation {
  color: #f8f8f2;
}

.namespace {
  opacity: 0.7;
}

.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
  color: #e6db74;
}

.token.boolean,
.token.number {
  color: #bd93f9;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #a8ff60;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
  color: #f8f8f2;
}

.token.atrule,
.token.attr-value,
.token.function,
.token.class-name {
  color: #66d9ef;
}

.token.keyword {
  color: #ff79c6;
}

.token.regex,
.token.important {
  color: #fd971f;
}

.token.important,
.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}

.token.entity {
  cursor: help;
}

/* 特殊注释样式 */
.comment-icon.success {
  color: #27c93f;
}

.comment-icon.error {
  color: #ff5f56;
}

/* 代码块头部样式 */
.code-block-wrapper .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background-color: #f0f0f0;
  border-bottom: 1px solid #ddd;
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
}

.code-block-wrapper .dots {
  display: flex;
  gap: 6px;
}

.code-block-wrapper .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transition: opacity 0.3s ease;
}

.code-block-wrapper .dot.red {
  background-color: #ff5f56;
}

.code-block-wrapper .dot.yellow {
  background-color: #ffbd2e;
}

.code-block-wrapper .dot.green {
  background-color: #27c93f;
}

.code-block-wrapper .language {
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  transition: color 0.3s ease;
}

.code-block-wrapper .copy-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: #666;
  transition:
    color 0.3s ease,
    background-color 0.3s ease;
  padding: 4px 8px;
  border-radius: 4px;
}

.code-block-wrapper .copy-btn:hover {
  color: var(--color-accent-teal);
  background-color: rgba(42, 157, 143, 0.1);
}

/* 暗色模式适配 - 使用类选择器而不是媒体查询 */
.dark .code-block-wrapper .code-header {
  background-color: #2a2a2a;
  border-bottom: 1px solid #444;
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
}

.dark .code-block-wrapper .language {
  color: #ccc;
}

.dark .code-block-wrapper .copy-btn {
  color: #ccc;
}

.dark .code-block-wrapper .copy-btn:hover {
  color: var(--color-accent-cyan);
  background-color: rgba(100, 255, 218, 0.1);
}

/* 暗色模式下的点增强效果 */
.dark .code-block-wrapper .dot {
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.dark .code-block-wrapper .dot.red {
  box-shadow: 0 0 4px rgba(255, 95, 86, 0.5);
}

.dark .code-block-wrapper .dot.yellow {
  box-shadow: 0 0 4px rgba(255, 189, 46, 0.5);
}

.dark .code-block-wrapper .dot.green {
  box-shadow: 0 0 4px rgba(39, 201, 63, 0.5);
}

/* 暗色模式下的代码块增强 */
.dark pre[class*="language-"] {
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.6);
}
